{% extends "GairalAdminBundle::layout.html.twig" %}

{% block bodyAdmin %}
<section id="SkillAdmin" class="content">
    <div class="row-fluid">
        <table class="table table-striped table-condensed">
            <caption>
                <h4>Skills</h4>
            </caption>
            <thead>
                <tr>
                    <th>Skill name</th>
                    <th>Description</th>
                    <th>Category</th>
                    <th>Level</th>
                    <th>Edu / Exp</th>
                    <th>Actions</th>
                </tr>
            </thead>
            <tbody>
                <tr>
                    <td colspan="6">
                        <div class="modal hide" id="addSkill">
                            <div class="modal-header"> <a class="close" data-dismiss="modal">×</a>
                                <h3>Add new Skill</h3>
                            </div>
                            {{ render(controller("GairalAdminBundle:SkillAdmin:add")) }}
                        </div>
                        <div class="btn-toolbar text-center">
                            <a href="#addSkill" data-toggle="modal" class="btn btn-large btn-primary">
                                Add new Skill
                                <i class="icon-white icon-plus"></i>
                            </a>
                        </div>
                    </td>
                </tr>
    {% for skill in listSkills %}
                <tr>
                    <td>{{ skill.name }}</td>
                    <td>{{ skill.description }}</td>
                    <td>{{ skill.category.name }}</td>
                    <td>
                    {% if skill.level %}<progress value="{{ skill.level }}" max="100"></progress>
                    {% endif %}
                    </td>
                        <td>
                    {% if skill.educations|length > 0 %}
                                <div class="btn-group">
                                    <a class="btn  btn-info dropdown-toggle" data-toggle="dropdown" href="#">
                                        Education
                                        <span class="caret"></span>
                                    </a>
                                    <ul class="dropdown-menu">
                    {% for education in skill.educations %}
                                            <li><a tabindex="-1" href="#">{{ education.name }}</a></li>
                    {% endfor %}
                                            </ul>
                                        </div>
                    {% endif %}
                    {% if skill.experiences|length > 0 %}
                                        <div class="btn-group">
                                            <a class="btn btn-info dropdown-toggle" data-toggle="dropdown" href="#">
                                                Experience
                                                <span class="caret"></span>
                                            </a>
                                            <ul class="dropdown-menu">
                    {% for experience in skill.experiences %}
                                                    <li><a tabindex="-1" href="#">{{ experience.name }}</a></li>
                    {% endfor %}
                                                    </ul>
                                                </div>
                    {% endif %}
                                            </td>
                    <td>
                        <div class="btn-toolbar">
                            <div class="btn-group">
                                <a href="{{ path('AdminSkillModify', {'id': skill.id})}}" data-toggle="modal" class="btn btn-small btn-inverse">
                                    Edit
                                    <i class="icon-white icon-edit"></i>
                                </a>
                            </div>
                            <a href="#remove_{{skill.id}}" data-toggle="modal" class="btn btn-small btn-danger">
                                Remove
                                <i class="icon-white icon-trash"></i>
                            </a>
                        </div>
                        <div class="modal hide" id="remove_{{skill.id}}">
                            <div class="modal-header"> <a class="close" data-dismiss="modal">×</a>
                                <h3>Remove Skill</h3>
                            </div>
                            <div class="modal-body alert">
                                <p>
                                    Are you sure to want to remove the Skill: "{{ skill.name }}" ?
                                </p>
                            </div>
                            <div class="modal-footer">
                                <a href="{{ path('AdminSkill') }}" class="btn btn-info" data-dismiss="modal">
                                    Cancel
                                </a>
                                <a href="{{ path('AdminSkillRemove', {'id': skill.id})}}" class="btn btn-danger">
                                    Remove
                                    <i class="icon-white icon-trash"></i>
                                </a>
                            </div>
                        </div>
                    </td>
                </tr>
    {% else %}
                no skills
    {% endfor %}

            </tbody>
        </table>
    </div>
</section>
{% endblock %}